Integrand size = 26, antiderivative size = 80 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx=2 a^2 (c-i d) x-\frac {2 a^2 (i c+d) \log (\cos (e+f x))}{f}-\frac {a^2 (c-i d) \tan (e+f x)}{f}+\frac {d (a+i a \tan (e+f x))^2}{2 f} \]
2*a^2*(c-I*d)*x-2*a^2*(I*c+d)*ln(cos(f*x+e))/f-a^2*(c-I*d)*tan(f*x+e)/f+1/ 2*d*(a+I*a*tan(f*x+e))^2/f
Time = 0.52 (sec) , antiderivative size = 58, normalized size of antiderivative = 0.72 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx=\frac {a^2 \left (d+4 (i c+d) \log (i+\tan (e+f x))-2 (c-2 i d) \tan (e+f x)-d \tan ^2(e+f x)\right )}{2 f} \]
(a^2*(d + 4*(I*c + d)*Log[I + Tan[e + f*x]] - 2*(c - (2*I)*d)*Tan[e + f*x] - d*Tan[e + f*x]^2))/(2*f)
Time = 0.34 (sec) , antiderivative size = 70, normalized size of antiderivative = 0.88, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3042, 4010, 3042, 3958, 3042, 3956}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))dx\) |
\(\Big \downarrow \) 4010 |
\(\displaystyle (c-i d) \int (i \tan (e+f x) a+a)^2dx+\frac {d (a+i a \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle (c-i d) \int (i \tan (e+f x) a+a)^2dx+\frac {d (a+i a \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3958 |
\(\displaystyle (c-i d) \left (2 i a^2 \int \tan (e+f x)dx-\frac {a^2 \tan (e+f x)}{f}+2 a^2 x\right )+\frac {d (a+i a \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle (c-i d) \left (2 i a^2 \int \tan (e+f x)dx-\frac {a^2 \tan (e+f x)}{f}+2 a^2 x\right )+\frac {d (a+i a \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle (c-i d) \left (-\frac {a^2 \tan (e+f x)}{f}-\frac {2 i a^2 \log (\cos (e+f x))}{f}+2 a^2 x\right )+\frac {d (a+i a \tan (e+f x))^2}{2 f}\) |
(d*(a + I*a*Tan[e + f*x])^2)/(2*f) + (c - I*d)*(2*a^2*x - ((2*I)*a^2*Log[C os[e + f*x]])/f - (a^2*Tan[e + f*x])/f)
3.11.66.3.1 Defintions of rubi rules used
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d *x], x]]/d, x] /; FreeQ[{c, d}, x]
Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2) *x, x] + (Simp[b^2*(Tan[c + d*x]/d), x] + Simp[2*a*b Int[Tan[c + d*x], x] , x]) /; FreeQ[{a, b, c, d}, x]
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Simp [(b*c + a*d)/b Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e , f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && !LtQ[m, 0]
Time = 0.22 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.95
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {d \left (\tan ^{2}\left (f x +e \right )\right )}{2}-c \tan \left (f x +e \right )+2 i \tan \left (f x +e \right ) d +\frac {\left (2 i c +2 d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-2 i d +2 c \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(76\) |
default | \(\frac {a^{2} \left (-\frac {d \left (\tan ^{2}\left (f x +e \right )\right )}{2}-c \tan \left (f x +e \right )+2 i \tan \left (f x +e \right ) d +\frac {\left (2 i c +2 d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-2 i d +2 c \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(76\) |
norman | \(\left (-2 i a^{2} d +2 a^{2} c \right ) x -\frac {\left (-2 i a^{2} d +a^{2} c \right ) \tan \left (f x +e \right )}{f}-\frac {a^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (i a^{2} c +a^{2} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) | \(87\) |
parallelrisch | \(\frac {-4 i x \,a^{2} d f +2 i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c +4 i \tan \left (f x +e \right ) a^{2} d +4 x \,a^{2} c f -a^{2} d \left (\tan ^{2}\left (f x +e \right )\right )+2 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} d -2 \tan \left (f x +e \right ) a^{2} c}{2 f}\) | \(98\) |
parts | \(a^{2} c x +\frac {\left (2 i a^{2} c +a^{2} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (2 i a^{2} d -a^{2} c \right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}-\frac {a^{2} d \left (\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}\) | \(104\) |
risch | \(\frac {4 i a^{2} d e}{f}-\frac {4 a^{2} c e}{f}-\frac {2 a^{2} \left (i c \,{\mathrm e}^{2 i \left (f x +e \right )}+3 \,{\mathrm e}^{2 i \left (f x +e \right )} d +i c +2 d \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}-\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d}{f}-\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c}{f}\) | \(120\) |
1/f*a^2*(-1/2*d*tan(f*x+e)^2-c*tan(f*x+e)+2*I*d*tan(f*x+e)+1/2*(2*d+2*I*c) *ln(1+tan(f*x+e)^2)+(2*c-2*I*d)*arctan(tan(f*x+e)))
Time = 0.24 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.69 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx=-\frac {2 \, {\left (i \, a^{2} c + 2 \, a^{2} d + {\left (i \, a^{2} c + 3 \, a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, a^{2} c + a^{2} d + {\left (i \, a^{2} c + a^{2} d\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, {\left (i \, a^{2} c + a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \]
-2*(I*a^2*c + 2*a^2*d + (I*a^2*c + 3*a^2*d)*e^(2*I*f*x + 2*I*e) + (I*a^2*c + a^2*d + (I*a^2*c + a^2*d)*e^(4*I*f*x + 4*I*e) + 2*(I*a^2*c + a^2*d)*e^( 2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e) + 1))/(f*e^(4*I*f*x + 4*I*e) + 2 *f*e^(2*I*f*x + 2*I*e) + f)
Time = 0.30 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.52 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx=- \frac {2 i a^{2} \left (c - i d\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 2 i a^{2} c - 4 a^{2} d + \left (- 2 i a^{2} c e^{2 i e} - 6 a^{2} d e^{2 i e}\right ) e^{2 i f x}}{f e^{4 i e} e^{4 i f x} + 2 f e^{2 i e} e^{2 i f x} + f} \]
-2*I*a**2*(c - I*d)*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-2*I*a**2*c - 4*a **2*d + (-2*I*a**2*c*exp(2*I*e) - 6*a**2*d*exp(2*I*e))*exp(2*I*f*x))/(f*ex p(4*I*e)*exp(4*I*f*x) + 2*f*exp(2*I*e)*exp(2*I*f*x) + f)
Time = 0.41 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.04 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx=-\frac {a^{2} d \tan \left (f x + e\right )^{2} - 4 \, {\left (a^{2} c - i \, a^{2} d\right )} {\left (f x + e\right )} - 2 \, {\left (i \, a^{2} c + a^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 2 \, {\left (a^{2} c - 2 i \, a^{2} d\right )} \tan \left (f x + e\right )}{2 \, f} \]
-1/2*(a^2*d*tan(f*x + e)^2 - 4*(a^2*c - I*a^2*d)*(f*x + e) - 2*(I*a^2*c + a^2*d)*log(tan(f*x + e)^2 + 1) + 2*(a^2*c - 2*I*a^2*d)*tan(f*x + e))/f
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 214 vs. \(2 (70) = 140\).
Time = 0.44 (sec) , antiderivative size = 214, normalized size of antiderivative = 2.68 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx=-\frac {2 \, {\left (i \, a^{2} c e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + a^{2} d e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 2 i \, a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 2 \, a^{2} d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} + 3 \, a^{2} d e^{\left (2 i \, f x + 2 i \, e\right )} + i \, a^{2} c \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + a^{2} d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, a^{2} c + 2 \, a^{2} d\right )}}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \]
-2*(I*a^2*c*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + a^2*d*e^(4* I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 2*I*a^2*c*e^(2*I*f*x + 2*I*e )*log(e^(2*I*f*x + 2*I*e) + 1) + 2*a^2*d*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f* x + 2*I*e) + 1) + I*a^2*c*e^(2*I*f*x + 2*I*e) + 3*a^2*d*e^(2*I*f*x + 2*I*e ) + I*a^2*c*log(e^(2*I*f*x + 2*I*e) + 1) + a^2*d*log(e^(2*I*f*x + 2*I*e) + 1) + I*a^2*c + 2*a^2*d)/(f*e^(4*I*f*x + 4*I*e) + 2*f*e^(2*I*f*x + 2*I*e) + f)
Time = 5.89 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.95 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx=\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,d\,1{}\mathrm {i}+a^2\,\left (d+c\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (2\,a^2\,d+a^2\,c\,2{}\mathrm {i}\right )}{f}-\frac {a^2\,d\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2\,f} \]